﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt
{
	// Token: 0x020000AE RID: 174
	public class TExplainPlan : TCustomSqlStatement
	{
		// Token: 0x170000DD RID: 221
		// (get) Token: 0x0600057E RID: 1406 RVA: 0x002FD0FB File Offset: 0x002FB2FB
		// (set) Token: 0x0600057F RID: 1407 RVA: 0x002FD103 File Offset: 0x002FB303
		public virtual TCustomSqlStatement Statement
		{
			get
			{
				return this.statement;
			}
			set
			{
				this.statement = value;
			}
		}

		// Token: 0x06000580 RID: 1408 RVA: 0x002FD10C File Offset: 0x002FB30C
		public TExplainPlan(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstExplain;
		}

		// Token: 0x06000581 RID: 1409 RVA: 0x002FD120 File Offset: 0x002FB320
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			base.doParseStatement(psql);
			int nodeType = this.rootNode.NodeType;
			switch (nodeType)
			{
			case 100:
				this.statement = new TSelectSqlStatement(this.dbvendor);
				break;
			case 101:
				this.statement = new TDeleteSqlStatement(this.dbvendor);
				break;
			case 102:
				this.statement = new TUpdateSqlStatement(this.dbvendor);
				break;
			case 103:
				this.statement = new TInsertSqlStatement(this.dbvendor);
				break;
			case 104:
				this.statement = new TCreateTableSqlStatement(this.dbvendor);
				break;
			default:
				if (nodeType == 116)
				{
					this.statement = new TCreateIndexSqlStatement(this.dbvendor);
				}
				break;
			}
			this.statement.rootNode = this.rootNode;
			this.statement.doParseStatement(this);
			return 0;
		}

		// Token: 0x06000582 RID: 1410 RVA: 0x002FD1FE File Offset: 0x002FB3FE
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000583 RID: 1411 RVA: 0x002FD20E File Offset: 0x002FB40E
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			this.statement.accept(v);
			v.postVisit(this);
		}

		// Token: 0x04001149 RID: 4425
		private TCustomSqlStatement statement;
	}
}
